
public class ChangeDir {

	public static void main(String[] args) {
		String finalDir = "1A/src";
		String currentDir = "1A/target/classes";
		
		if( !finalDir.equalsIgnoreCase(currentDir) ) {
			char[] finalArray = finalDir.toCharArray();
			char[] currentArray = currentDir.toCharArray();
			String path = "";
			int sizeArray = Math.min(finalArray.length,currentArray.length);
			for( int i=0; i<sizeArray;i++ ) {
				if( finalArray[i] == currentArray[i] ) {
					path += finalArray[i];
				} else {
					break;
				}
			}
			String tailStr = currentDir.substring(path.length(), currentDir.length());
			System.out.print("需動作"+tailStr.split("/").length+"次, ");
			System.out.println("應切換到："+path);
		}

	}

}
